<template>
    <page-frame>
        <div class="order-management scale">
            <div class="toptitle">
                <div class="left">评估量表-编辑量表</div>
            </div>
          <div class="borderT"></div>
            <div class="order-content">
                <div class="addScaleTop">
                    <el-form :inline="true" :model="assessSheetVO1" class="top-form-inline" label-width="100px">
                        <el-form-item label="评估名称">
                            <el-input v-model="assessSheetVO1.sheetName" placeholder="评估名称"></el-input>
                        </el-form-item>
                        <el-form-item label="评估类型">
                            <el-select v-model="assessSheetVO1.sheetType" placeholder="评估类型">
                                <div v-if="pinggulieixng" v-for="(data,index) in pinggulieixng" class="data">
                                    <el-option :label=data.dicName :value=data.dicValue ></el-option>
                                </div>
                                <!--<el-option label="入住评估" value="0"></el-option>-->
                                <!--<el-option label="体检评估" value="1"></el-option>-->
                                <!--<el-option label="健康评估" value="2"></el-option>-->
                            </el-select>
                        </el-form-item>
                    </el-form>
                </div>
                <div class="addScaleBottom">
                    <el-collapse v-if="assessSheetVO1.assessSetDTOList"
                                 v-for="(data,index) in assessSheetVO1.assessSetDTOList" class="data">
                        <div  v-if="data.deleted == 0 ">
                            <div v-if="index != assessSheetVO1.assessSetDTOList.length-1 ">
                                <!--//在此添加最外层的删除和添加按钮-->
                                <el-collapse-item :title=titleName>
                                    <template slot=title>
                                        {{titleName}}&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
                                        <el-button :plain="true" size="small" type="success"
                                                   @click.stop="removeProjectBtn(index)">删除项目
                                        </el-button>
                                    </template>
                                    <div class="addScaleBottomtitle">
                                        <el-form :inline="true" :model="data.setName" class="top-form-inline"
                                                 label-width="100px">
                                            <el-form-item label="项目名称">
                                                <el-input v-model="data.setName" placeholder="项目名称"></el-input>
                                            </el-form-item>
                                        </el-form>
                                    </div>
                                    <div class="addScaleBottomDetile">
                                        <el-collapse v-if="data.assessItemDTOList"
                                                     v-for="(datascal,index2) in data.assessItemDTOList"
                                                     class="ScaledataClass">
                                            <div v-if="datascal.deleted == 0">
                                                <el-form :model="datascal" ref="datascal" label-width="100px"
                                                         class="demo-dynamic">
                                                    <el-form-item
                                                            prop="itemTitle"
                                                            label="评估事项"
                                                            :rules="[
      { required: true, message: '请输入评估事项', trigger: 'blur' },
    ]"
                                                    >
                                                        <el-input v-model="datascal.itemTitle"
                                                                  placeholder="进食：使用餐具将饭菜送入口"></el-input>
                                                        <div v-if="index2 != data.assessItemDTOList.length-1 ">
                                                            <el-button :plain="true" type="success"
                                                                       @click="remBtn(index,index2)">删除
                                                            </el-button>
                                                        </div>
                                                        <div v-else="index2 = data.assessItemDTOList.length-1 ">
                                                            <div v-if="data.assessItemDTOList.length == 1 ">
                                                                <el-button :plain="true" type="success"
                                                                           @click="addBtn(index,index2)">新增事项
                                                                </el-button>
                                                            </div>
                                                            <div v-else="data.assessItemDTOList.length > 1 ">
                                                                <el-button :plain="true" type="success"
                                                                           @click="remBtn(index,index2)">删除
                                                                </el-button>
                                                                <el-button :plain="true" type="success"
                                                                           @click="addBtn(index,index2)">新增事项
                                                                </el-button>
                                                            </div>
                                                        </div>
                                                    </el-form-item>
                                                    <el-row>
                                                        <el-col :span="12">
                                                            <el-form-item label="结果类型">
                                                                <el-select v-model="datascal.type" placeholder="单选">
                                                                    <el-option label="单选" value= 0 ></el-option>
                                                                    <el-option label="多选" value= 1 ></el-option>
                                                                    <el-option label="填空" value= 2 ></el-option>
                                                                </el-select>
                                                            </el-form-item>
                                                        </el-col>
                                                        <el-col :span="8">
                                                            <div v-if="datascal.type !=3 ">
                                                                <el-form-item label="'其他'选项">
                                                                    <template >
                                                                        <el-radio class="radio" v-model="datascal.other" label= "1" >是</el-radio>
                                                                        <el-radio class="radio" v-model="datascal.other" label= "0" >否</el-radio>
                                                                    </template>
                                                                </el-form-item>
                                                            </div>
                                                        </el-col>
                                                    </el-row>
                                                    <el-row>
                                                        <div v-if="datascal.type !=3 ">
                                                            <el-form-item
                                                                    v-for="(domain, index1) in datascal.assessItemResultDTOList"
                                                                    label="选项"
                                                                    :prop=domain.name
                                                                    :rules="{
      required: true, message: '选项不能为空', trigger: 'blur'
    }"
                                                            >
                                                                <div v-if="domain.deleted ==0">
                                                                <el-col :span="9">
                                                                    <el-input v-model="domain.name" width="100px"
                                                                              placeholder="在此输入选择项"></el-input>
                                                                </el-col>
                                                                <el-col :span="4">
                                                                    <el-form-item label="分数">
                                                                        <el-input v-model="domain.value"
                                                                                  placeholder="分数"></el-input>
                                                                    </el-form-item>
                                                                </el-col>
                                                                <el-col :span="5" style="margin-left:10px;">
                                                                    <div v-if="index1 != datascal.assessItemResultDTOList.length-1 ">
                                                                        <el-button
                                                                                @click.prevent="removeDomain(domain,index,index2,index1)">
                                                                            删除
                                                                        </el-button>
                                                                    </div>
                                                                    <div v-else="index1 = datascal.assessItemResultDTOList.length-1 ">
                                                                        <div v-if="datascal.assessItemResultDTOList.length == 1 ">
                                                                            <el-button
                                                                                    @click.prevent="addDomain(domain,index,index2,index1)">
                                                                                新增选项
                                                                            </el-button>
                                                                        </div>
                                                                        <div v-else="datascal.assessItemResultDTOList.length > 1 ">
                                                                            <el-button
                                                                                    @click.prevent="removeDomain(domain,index,index2,index1)">
                                                                                删除
                                                                            </el-button>
                                                                            <el-button
                                                                                    @click.prevent="addDomain(domain,index,index2,index1)">
                                                                                新增选项
                                                                            </el-button>
                                                                        </div>
                                                                    </div>
                                                                </el-col>
                                                                </div>
                                                            </el-form-item>
                                                        </div>
                                                    </el-row>
                                                </el-form>
                                            </div>
                                        </el-collapse>

                                    </div>
                                    <div class="classPriject">评估结果：评估项目</div>
                                    <div class="bottomDiv">
                                        <div v-if="data.assessSetResultDTOList"
                                             v-for="(dataPriject,index3) in data.assessSetResultDTOList"
                                             class="bottomdivtop">
                                            <div v-if="dataPriject.deleted == 0">
                                                <el-form ref="form" :model="dataPriject" label-width="80px">
                                                    <el-col :span="11">
                                                        <el-form-item label="结果">
                                                            <el-input v-model="dataPriject.resultName" ></el-input>
                                                        </el-form-item>
                                                    </el-col>
                                                    <el-col :span="10">
                                                        <el-form-item label="分值区间">
                                                            <el-col :span="6">
                                                                <el-input type="input" placeholder="0"
                                                                          v-model="dataPriject.valueMin"
                                                                          style="width: 100%;"></el-input>
                                                            </el-col>
                                                            <el-col class="line" :span="2">-&nbsp;</el-col>
                                                            <el-col :span="6">
                                                                <el-input type="input" placeholder="15"
                                                                          v-model="dataPriject.valueMax"
                                                                          style="width: 100%;"></el-input>
                                                            </el-col>
                                                        </el-form-item>
                                                    </el-col>
                                                    <el-col :span="3">
                                                        <div v-if="data.assessSetResultDTOList.length == 1 ">
                                                            <el-button :plain="true" type="success"
                                                                       @click="tianjia(index,index3)">新增
                                                            </el-button>
                                                        </div>
                                                        <div v-else="data.assessSetResultDTOList.length > 1 ">
                                                            <div v-if="index3 != data.assessSetResultDTOList.length-1 ">
                                                                <el-button :plain="true" type="success"
                                                                           @click="shanchu(index,index3)">删除
                                                                </el-button>
                                                            </div>
                                                            <div v-else="index3 = data.assessSetResultDTOList.length-1 ">
                                                                <el-button :plain="true" type="success"
                                                                           @click="shanchu(index,index3)">删除
                                                                </el-button>
                                                                <el-button :plain="true" type="success"
                                                                           @click="tianjia(index,index3)">新增
                                                                </el-button>
                                                            </div>
                                                        </div>
                                                    </el-col>
                                                </el-form>
                                            </div>
                                        </div>
                                    </div>
                                </el-collapse-item>
                            </div>
                            <div v-else="index == assessSheetVO1.assessSetDTOList.length-1 ">
                                <el-collapse-item :title=titleName>
                                    <template slot=title>
                                        {{titleName}}&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
                                        <el-button :plain="true" size="small" type="success"
                                                   @click.stop="removeProjectBtn(index)">删除项目
                                        </el-button>
                                        <el-button :plain="true" size="small" type="success"
                                                   @click.stop="addProjectBtn(index)">新增项目
                                        </el-button>
                                    </template>
                                    <div class="addScaleBottomtitle">
                                        <el-form :inline="true" :model="data.setName" class="top-form-inline"
                                                 label-width="100px">
                                            <el-form-item label="项目名称">
                                                <el-input v-model="data.setName" placeholder="项目名称"></el-input>
                                            </el-form-item>
                                        </el-form>
                                    </div>
                                    <div class="addScaleBottomDetile">
                                        <el-collapse v-if="data.assessItemDTOList"
                                                     v-for="(datascal,index2) in data.assessItemDTOList"
                                                     class="ScaledataClass">
                                            <div v-if="datascal.deleted == 0" >
                                                <el-form :model="datascal" ref="datascal" label-width="100px"
                                                         class="demo-dynamic">
                                                    <el-form-item
                                                            prop="itemTitle"
                                                            label="评估事项"
                                                            :rules="[
      { required: true, message: '请输入评估事项', trigger: 'blur' },
    ]"
                                                    >
                                                        <el-input v-model="datascal.itemTitle"
                                                                  placeholder="进食：使用餐具将饭菜送入口"></el-input>
                                                        <div v-if="index2 != data.assessItemDTOList.length-1 ">
                                                            <el-button :plain="true" type="success"
                                                                       @click="remBtn(index,index2)">删除
                                                            </el-button>
                                                        </div>
                                                        <div v-else="index2 = data.assessItemDTOList.length-1 ">
                                                            <div v-if="data.assessItemDTOList.length == 1 ">
                                                                <el-button :plain="true" type="success"
                                                                           @click="addBtn(index,index2)">新增事项
                                                                </el-button>
                                                            </div>
                                                            <div v-else="data.assessItemDTOList.length > 1 ">
                                                                <el-button :plain="true" type="success"
                                                                           @click="remBtn(index,index2)">删除
                                                                </el-button>
                                                                <el-button :plain="true" type="success"
                                                                           @click="addBtn(index,index2)">新增事项
                                                                </el-button>
                                                            </div>
                                                        </div>
                                                    </el-form-item>
                                                    <el-row>
                                                        <el-col :span="12">
                                                            <el-form-item label="结果类型">
                                                                <el-select v-model="datascal.type" placeholder="单选" @change="selectChange">
                                                                    <el-option label="单选" value= 0></el-option>
                                                                    <el-option label="多选" value= 1></el-option>
                                                                    <el-option label="填空" value= 2></el-option>
                                                                </el-select>
                                                            </el-form-item>
                                                        </el-col>
                                                        <el-col :span="8">
                                                            <div v-if="datascal.type !=3 ">
                                                                <el-form-item label="'其他'选项">
                                                                    <template >
                                                                        <el-radio class="radio" v-model="datascal.other" label= "1" >是</el-radio>
                                                                        <el-radio class="radio" v-model="datascal.other" label= "0" >否</el-radio>
                                                                    </template>
                                                                </el-form-item>
                                                            </div>
                                                        </el-col>
                                                        <!--<label >'其他'选项&nbsp;</label>-->
                                                    </el-row>
                                                    <el-row>
                                                        <div v-if="datascal.type !=3 ">
                                                            <el-form-item
                                                                    v-for="(domain, index1) in datascal.assessItemResultDTOList"
                                                                    v-if="isoptions"
                                                                    label="选项"
                                                                    prop=domain.name
                                                                    :rules="[{
      required: true, message: '选项不能为空', trigger: 'blur'
    }]"
                                                            >
                                                                <div v-if="domain.deleted == 0">
                                                                    <el-col :span="9">
                                                                        <el-input v-model="domain.name" width="100px"
                                                                                  placeholder="在此输入选择项" ></el-input>
                                                                    </el-col>
                                                                    <el-col :span="4">
                                                                        <el-form-item label="分数"   v-if="score">
                                                                            <el-input v-model="domain.value"
                                                                                      placeholder="分数"></el-input>
                                                                        </el-form-item>
                                                                    </el-col>
                                                                    <el-col :span="5" style="margin-left:10px;">
                                                                        <div v-if="index1 != datascal.assessItemResultDTOList.length-1 ">
                                                                            <el-button
                                                                                    @click.prevent="removeDomain(domain,index,index2,index1)">
                                                                                删除
                                                                            </el-button>
                                                                        </div>
                                                                        <div v-else="index1 = datascal.assessItemResultDTOList.length-1 ">
                                                                            <div v-if="datascal.assessItemResultDTOList.length == 1 ">
                                                                                <el-button
                                                                                        @click.prevent="addDomain(domain,index,index2,index1)">
                                                                                    新增选项
                                                                                </el-button>
                                                                            </div>
                                                                            <div v-else="datascal.assessItemResultDTOList.length > 1 ">
                                                                                <el-button
                                                                                        @click.prevent="removeDomain(domain,index,index2,index1)">
                                                                                    删除
                                                                                </el-button>
                                                                                <el-button
                                                                                        @click.prevent="addDomain(domain,index,index2,index1)">
                                                                                    新增选项
                                                                                </el-button>
                                                                            </div>
                                                                        </div>
                                                                    </el-col>
                                                                </div>

                                                            </el-form-item>
                                                        </div>
                                                    </el-row>
                                                </el-form>
                                            </div>
                                        </el-collapse>

                                    </div>
                                    <div class="classPriject">评估结果：评估项目</div>
                                    <div class="bottomDiv">
                                        <div v-if="data.assessSetResultDTOList"
                                             v-for="(dataPriject,index3) in data.assessSetResultDTOList"
                                             class="bottomdivtop">
                                            <div v-if="dataPriject.deleted == 0 ">
                                                <el-form ref="form" :model="dataPriject" label-width="80px">
                                                    <el-col :span="11">
                                                        <el-form-item label="结果">
                                                            <el-input v-model="dataPriject.resultName"></el-input>
                                                        </el-form-item>
                                                    </el-col>
                                                    <el-col :span="10">
                                                        <el-form-item label="分值区间">
                                                            <el-col :span="6">
                                                                <el-input type="input" placeholder="0"
                                                                          v-model="dataPriject.valueMin"
                                                                          style="width: 100%;"></el-input>
                                                            </el-col>
                                                            <el-col class="line" :span="2">-&nbsp;</el-col>
                                                            <el-col :span="6">
                                                                <el-input type="input" placeholder="15"
                                                                          v-model="dataPriject.valueMax"
                                                                          style="width: 100%;"></el-input>
                                                            </el-col>
                                                        </el-form-item>
                                                    </el-col>
                                                    <el-col :span="3">
                                                        <div v-if="data.assessSetResultDTOList.length == 1 ">
                                                            <el-button :plain="true" type="success"
                                                                       @click="tianjia(index,index3)">新增
                                                            </el-button>
                                                        </div>
                                                        <div v-else="data.assessSetResultDTOList.length > 1 ">
                                                            <div v-if="index3 != data.assessSetResultDTOList.length-1 ">
                                                                <el-button :plain="true" type="success"
                                                                           @click="shanchu(index,index3)">删除
                                                                </el-button>
                                                            </div>
                                                            <div v-else="index3 = data.assessSetResultDTOList.length-1 ">
                                                                <el-button :plain="true" type="success"
                                                                           @click="shanchu(index,index3)">删除
                                                                </el-button>
                                                                <el-button :plain="true" type="success"
                                                                           @click="tianjia(index,index3)">新增
                                                                </el-button>
                                                            </div>
                                                        </div>
                                                    </el-col>
                                                </el-form>
                                            </div>
                                        </div>
                                    </div>
                                </el-collapse-item>
                            </div>
                        </div>
                    </el-collapse>
                </div>
                <div style="width: 300px;">评估结果：评估量表</div>
                <div class="bottomDiv">
                    <div v-if="assessSheetVO1.assessSheetResultDTOList"
                         v-for="(data,index) in assessSheetVO1.assessSheetResultDTOList" class="bottomdivtop">
                        <div v-if="data.deleted == 0 ">
                            <el-form ref="form" :model="data" label-width="80px">
                                <el-col :span="11">
                                    <el-form-item label="结果">
                                        <el-input v-model="data.resultName" :maxlength="20"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="10">
                                    <el-form-item label="分值区间">
                                        <el-col :span="6">
                                            <el-input type="input" placeholder="0" v-model="data.valueMin"
                                                      style="width: 100%;"></el-input>
                                        </el-col>
                                        <el-col class="line" :span="2">-&nbsp;</el-col>
                                        <el-col :span="6">
                                            <el-input type="input" placeholder="15" v-model="data.valueMax"
                                                      style="width: 100%;"></el-input>
                                        </el-col>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="3">
                                    <div v-if="assessSheetVO1.assessSheetResultDTOList.length == 1 ">
                                        <el-button :plain="true" type="success" @click="scaleToAdd(index)">新增
                                        </el-button>
                                    </div>
                                    <div v-else="assessSheetVO1.assessSheetResultDTOList.length > 1 ">
                                        <div v-if="index != assessSheetVO1.assessSheetResultDTOList.length-1 ">
                                            <el-button :plain="true" type="success" @click="scaleToRemove(index)">删除
                                            </el-button>
                                        </div>
                                        <div v-else="index = assessSheetVO1.assessSheetResultDTOList.length-1 ">
                                            <el-button :plain="true" type="success" @click="scaleToRemove(index)">删除
                                            </el-button>
                                            <el-button :plain="true" type="success" @click="scaleToAdd(index)">新增
                                            </el-button>
                                        </div>
                                    </div>
                                </el-col>
                            </el-form>
                        </div>
                    </div>
                </div>
                <div style="width: 900px;text-align: center;margin-top: 70px">
                    <el-button :plain="true" type="success">取消</el-button>
                    <el-button type="primary" @click="onSubmit">保存</el-button>
                </div>
            </div>
        </div>
    </page-frame>
</template>

<script>
    import Vue from 'vue'
    import VueResource from 'vue-resource';
    Vue.use(VueResource);
    export default {
        data () {
            return {
                titleName: "评估项目",
//                assessSheetVO: {
//                },
                pinggulieixng:[
                    {
                        dicName:"",
                        dicValue:"",
                    }
                ],
                assessSheetVO1: {
//                    assessSheetResultDTOList: [//评估结果-评估量表
//                        {
//                            resultName: "",//评估结果名称
//                            valueMax: "",//
//                            valueMin: "",//
//                        },
//                    ],
//                    sheetId: "",//量表ID
//                    sheetName: "",//评估量表名称
//                    sheetType: "",//评估类型，1入住评估、2健康评估
//                    assessSetDTOList: [//评估项目
//                        {
//                            assessItemDTOList: [
//                                {
//                                    assessItemResultDTOList: [{
//                                        name: '',//选择项
//                                        value: ''//分数
//                                    }],
//                                    itemTitle: "",//评估事项
//                                    type: "1",//单选多选
//                                    other: "0",//是否其他1：是 0：否
//                                },
//                            ],
//                            setName: "",//项目名称
//                            assessSetResultVOList: [//评估结果-评估项目
//                                {
//                                    resultName: "",//评估结果名称
//                                    valueMax: "",//
//                                    valueMin: "",//
//                                },
//                            ],
//
//                        },
//                    ],
                },
                isoptions:true,
                 score:true,
            }
        },
        methods: {
            init() {
                this.getProjectList()
            },
            getProjectList(){
                console.log("获取了数据");
              let sheetId = this.$route.query.sheetId;
              console.log(sheetId);
                Vue.http.get("/assessSheet/m/v1/getAssessSheetDetail/"+sheetId).then(
                    (response) => {
//                        console.log("获取的数据为："+response.data);
                        this.assessSheetVO1 = response.body.data;
                        this.getScaleProjectList(this.assessSheetVO1.sheetType);
                    },
                );

            },
            onSubmit(){//提交按钮
                console.log("====获======="+this.assessSheetVO1);
                for (var i=0;i< this.pinggulieixng.length ;i++){
                    var object = this.pinggulieixng[i];
                    console.log("获取了列表数据类型数据===="+object +"数组："+object.dicValue +"===="+this.assessSheetVO1.sheetType);
                    if (object.dicName == this.assessSheetVO1.sheetType){
                        console.log("获取=================");
                        this.assessSheetVO1.sheetType =object.dicValue;
                    }
                }
                Vue.http.post("/assessSheet/m/v1/saveAssessSheet", this.assessSheetVO1).then(
                    (response) => {
                        console.log("====获取的数据为=======");
                        console.log("获取的数据为：" + response);
                        window.history.back();
                    },
                );

            },
            //获取评估类型列表
            getScaleProjectList(listId){
                console.log("获取了列表数据类型数据");
                Vue.http.get("/assessSheet/m/v1/getAssessSheetTypeList/" +listId).then(
                    (response) => {
                        this.pinggulieixng = response.body.data;
                        for (var i=0;i< this.pinggulieixng.length ;i++){
                            var object = this.pinggulieixng[i];
                            console.log("获取了列表数据类型数据===="+object +"数组："+object.dicValue +"===="+this.assessSheetVO1.sheetType);
                            if (object.dicValue == this.assessSheetVO1.sheetType){
                                console.log("获取=================");
                                this.assessSheetVO1.sheetType =object.dicName;
                            }
                        }
                    },
                );

            },

          selectChange(val){
            if(val==2){
              this.isoptions=false;
              this.scope=false;
            }else{
              this.isoptions=true;
              this.scope=true;
            }
          },

            //最下方评估量表
            scaleToRemove(index){
//                var dictObjec = this.assessSheetVO.assessSetResultDTOList[index];
//                if (this.assessSheetVO.assessSetResultDTOList.length > 1) {
//                    this.assessSheetVO.assessSetResultDTOList.splice(index, 1);
//                };
                //---------
              //  var dictObjec1 = this.assessSheetVO1.assessSheetResultDTOList[index];
              //  dictObjec1.deleted = 1;

              var dictObjec = this.assessSheetVO1.assessSheetResultDTOList[index];
                  if(dictObjec!="" ) {
                    Vue.http.post("/assessSheet/m/v1/deleteAssessSheet",dictObjec);
                  }
                   this.assessSheetVO1.assessSheetResultDTOList.splice(index, 1);
            },
            scaleToAdd(index){
                var object = {
                    resultName: "",//评估结果名称
                    valueMax: "",//
                    valueMin: "",//
                    deleted:0
                };
//                this.assessSheetVO.assessSetResultDTOList.push(object);
                //----------
                console.log("点击=="+this.assessSheetVO1.assessSheetResultDTOList);
                this.assessSheetVO1.assessSheetResultDTOList.push(object);
                console.log("点击1111=="+this.assessSheetVO1.assessSheetResultDTOList);

            },
            //评估结果
            shanchu(index, index3){
                console.log("点击了删除按钮");
//                var dictObjec = this.assessSheetVO.assessSetDTOList[index];
//                if (dictObjec.assessSetResultDTOList.length > 1) {
//                    dictObjec.assessSetResultDTOList.splice(index3, 1);
//                }
                //----------
                var dictObjec1 = this.assessSheetVO1.assessSetDTOList[index];
                var dictObjec2 = dictObjec1.assessSetResultDTOList[index3];
                dictObjec2.deleted = 1;
            },
            tianjia(index, index3){
                console.log("点击了添加按钮");
                var object = {
                    resultName: "",//评估结果名称
                    valueMax: "",//
                    valueMin: "",//
                    deleted:0
                };
//                var dictObjec = this.assessSheetVO.assessSetDTOList[index];
//                dictObjec.assessSetResultDTOList.push(object);
                //------------
                var dictObjec = this.assessSheetVO1.assessSetDTOList[index];
                dictObjec.assessSetResultDTOList.push(object);

            },
            //
            remBtn(index, index2){
//                var dictObjec = this.assessSheetVO.assessSetDTOList[index];
//                if (dictObjec.assessItemDTOList.length > 1) {
//                    dictObjec.assessItemDTOList.splice(index2, 1);
//                }
                //----------
                var dictObjec1 = this.assessSheetVO1.assessSetDTOList[index];
                var dictObjec2 = dictObjec1.assessItemDTOList[index2];
                dictObjec2.deleted = "1";
            },
            addBtn(index, index2){
                console.log("点击了添加按钮");
                var objec = {
                    assessItemResultDTOList: [{
                        name: '',//选择项
                        value: '',//分数
                        deleted:0,
                    }],
                    itemTitle: "",//评估事项
                    type: "0",//单选多选
                    other: "0",//是否其他1：是 0：否
                    deleted:0
                };
//                var dictObjec = this.assessSheetVO.assessSetDTOList[index];
//                dictObjec.assessItemDTOList.push(objec);
                //----------------
                var dictObjec = this.assessSheetVO1.assessSetDTOList[index];
                dictObjec.assessItemDTOList.push(objec);
            },
            removeProjectBtn(index){//删除行
//                if (this.assessSheetVO.assessSetDTOList.length > 1) {
//                    this.assessSheetVO.assessSetDTOList.splice(index, 1);
//                }
                //---------
//                var dictObjec = this.assessSheetVO1.assessSetDTOList[index];
//                dictObjec.deleted = 1;
           //   let self = this;
            //  var dictObjec = this.assessSheetVO1.assessSetDTOList[index];
           //   if (this.assessSheetVO1.assessSetDTOList.length > 1) {
           //     if (dictObjec != "") {
            //  self.$confirm('请确认是否删除评估项目信息', '删除评估量项目信息', {
             //   confirmButtonText: '确定',
           //     cancelButtonText: '取消',
            //    type: 'warning'
             // }).then(() => {
             //     Vue.http.post("/assessSheet/m/v1/deleteAssessSetResult", this.assessSheetVO1.assessSetDTOList[index]).then(function () {
            //        self.$message({
            //          type: 'success',
             //         message: '删除成功!'
             //       });
            //    this.assessSheetVO1.assessSetDTOList.splice(index, 1);
              //    }, function () {
           //       });
         //   }).catch(() => {
          //      self.$message({
           //     type: 'info',
           //     message: '已取消删除'
          //    });
           // });
  //  }}
              var dictObjec = this.assessSheetVO1.assessSetDTOList[index];
              if (this.assessSheetVO1.assessSetDTOList.length > 1) {
                if (dictObjec != "") {
                  Vue.http.post("/assessSheet/m/v1/deleteAssessSetResult", this.assessSheetVO1.assessSetDTOList[index]);
                }
                this.assessSheetVO1.assessSetDTOList.splice(index, 1);
              }
            },
            addProjectBtn(index){//添加项目
                var object = {
                    assessItemDTOList: [
                        {
                            assessItemResultDTOList: [{
                                name: '',//选择项
                                value: '',//分数
                                deleted:0,
                            }],
                            itemTitle: "",//评估事项
                            type: "0",//单选多选
                            other: "0",//是否其他1：是 0：否
                            deleted:0,
                        },
                    ],
                    setName: "",//项目名称
                    assessSetResultDTOList: [//评估结果-评估项目
                        {
                            resultName: "",//评估结果名称
                            valueMax: "",//
                            valueMin: "",//
                            deleted:0,
                        },
                    ],
                    deleted:0

                };

//                this.assessSheetVO.assessSetDTOList.push(object);
                this.assessSheetVO1.assessSetDTOList.push(object);
            },
            removeDomain(item, index, index2, index1) {
                var dictObjec = this.assessSheetVO1.assessSetDTOList[index];
                var dictObjec1 = dictObjec.assessItemDTOList[index2];
                var index = dictObjec1.assessItemResultDTOList.indexOf(item);

                if (index !== -1 && dictObjec1.assessItemResultDTOList.length > 1) {
                    console.log(dictObjec1.assessItemResultDTOList[index].itemRId);
                  if(dictObjec1.assessItemResultDTOList[index].itemRId!="") {
                    Vue.http.post("/assessSheet/m/v1/deleteAssessItemResult/" + dictObjec1.assessItemResultDTOList[index].itemRId);
                  }
                  dictObjec1.assessItemResultDTOList.splice(index, 1);
                }
                //-------
//                var dictObjec2 = this.assessSheetVO1.assessSetDTOList[index];
//                var dictObjec3 = dictObjec2.assessItemDTOList[index2];
//                var dictObjec4 = dictObjec3.assessItemResultDTOList[index1];
//                dictObjec4.deleted = "1";

            },
            addDomain(item, index, index2, index1) {
//                var dictObjec = this.assessSheetVO.assessSetDTOList[index];
//                var dictObjec1 = dictObjec.assessItemDTOList[index2];
//                dictObjec1.assessItemResultDTOList.push({
//                    name: '',//选择项
//                    value: '',//分数
//                    deleted:"0"
//                });
                //-------------
                var dictObjec2 = this.assessSheetVO1.assessSetDTOList[index];
                var dictObjec3 = dictObjec2.assessItemDTOList[index2];
                dictObjec3.assessItemResultDTOList.push({
                    name: '',//选择项
                    value: '',//分数
                    deleted:0
                });
            },

        },

        mounted: function () {
            this.init();
        },
    }
</script>
<style>
    .scale .addScaleTop {
        width: 100%;
        margin: 20px auto;
        margin-left: -30px;
    }

    .scale .addScaleBottom {
        width: 100%;
        margin: 20px auto;
    }

    .scale .addScaleBottomtitle {
        margin-left: 0px;

    }

    .scale .addScaleBottomDetile .el-input,.scale .el-select,.scale .el-textarea {
        width: 40% !important;
        display: inline-block !important;
    }

    .scale .addScaleBottomDetile .el-input,.scale .el-select {
        width: 70% !important;
        float: left !important;
    }

    .scale .addScaleBottom .order-content .el-input,.scale .el-select {
        width: 100% !important;
        display: inline-block !important;
    }

    .scale .addScaleBottomDetile .el-button {
        margin-left: 30px;
    }

    .scale .demo-dynamic {
        margin-top: 30px;
    }

    .scale .el-form-item .el-form-item .el-form-item__content {
        margin-left: 100px !important;
    }

    .scale .bottomDiv {
        margin-top: 10px;
        margin-left: -10px;
    }

    .scale .classPriject {
        margin-top: 20px;
        font-size: 15px;
    }
</style>
